include<tools/util.scad>

$fn=100;

cross_style();

module cross_style(){
    difference(){
        union(){
        rotate([0,0,45])difference(){
            union(){
                difference(){
                    union(){
                        cylinder(h=2,d=44);
                        translate([0,0,2])cylinder(h=40,d=30);
                    }
                    translate([0,0,-0.5])cylinder(h=45,d=28);
                }

                translate([0,0,42])d_half_ball_shell(r=15,thick=1);
                //小把手
                translate([14,0,0])d_half_cy_cube(cd=5,cl=3,height=2);
            }
            translate([0,0,55])cube([5,5,10],center=true);
            
           for(zz=[12:8:36]){
                for (i = [-12:10:8]){
                    translate([i,-20,zz])cube([4,40,4]);
                }
            }
            translate([-2,-20,44])cube([4,40,4]);
            translate([-2,-20,50])cube([4,40,4]);
            translate([-22,-2,44])cube([40,4,4]);
            translate([-22,-2,50])cube([40,4,4]);
                
            }
        }
    
              translate([-2,-20,44])cube([4,40,4]);
            translate([-2,-20,50])cube([4,40,4]);
            translate([-22,-2,44])cube([40,4,4]);
            translate([-22,-2,50])cube([40,4,4]);
    }
}

module hole_style(){
    total_holes=160;

    difference(){
        union(){
            difference(){
                union(){
                    cylinder(h=2,d=44);
                    translate([0,0,2])cylinder(h=40,d=30);
                }
                translate([0,0,-0.5])cylinder(h=45,d=28);
            }

            translate([0,0,42])d_half_ball_shell(r=15,thick=1);
            //小把手
            translate([14,0,0])d_half_cy_cube(cd=5,cl=3,height=2);
        }
        for(i = [0:total_holes-1]) {
            theta = i * 360 / 1.618;        // 黄金角度
            r = 16.5 * sqrt(i/total_holes);  // 半径平方根分布
            x = r * cos(theta);
            y = r * sin(theta);
            
            translate([x, y, 43])
            cylinder(h=20, r=0.6);
        }
        for(zz=[12:4:36]){
            for (i = [-10:4:10]){
                translate([i,-20,zz])cube([1,40,1]);
            }
        }
            
    }
}